package planit.controller.impl;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import planit.model.Model;
import planit.view.DeleteGroupDialog;

@SuppressWarnings("serial")
public class DeleteGroupController extends AbstractAction {
	private Model model;

	public DeleteGroupController(Model model) {
		this.model = model;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		DeleteGroupDialog dialog = (DeleteGroupDialog)this.getValue("DeleteGroupDialog");

		model.getSchedule().removeGroup(
				model.getSchedule().getGroup(dialog.getGroupId()));
		dialog.updateGroupList();
	}

}
